package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/replies")
@RequiredArgsConstructor
public class InterationReplyAdminController {
    private final IInteractionReplyService replyService;

    /**
     * 管理端分页查询回答或评论列表
     */
    @GetMapping("/page")
    public PageDTO<ReplyVO> queryReply(ReplyPageQuery query, boolean isStudent){
        // 调用 service 层方法处理分页查询
        return replyService.queryReply(query, isStudent);
    }
    
    /**
     * 管理员隐藏或显示评论/回答
     * @param id 回答或评论的ID
     * @param hidden 是否隐藏 (true-隐藏, false-显示)
     */
    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏或显示评论/回答")
    public void hiddenReply(@PathVariable("id") Long id, @PathVariable("hidden") Boolean hidden) {
        replyService.hiddenReply(id, hidden);
    }

}